package com.magic.smartcity.view.adapters;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.magic.smartcity.R;
import com.magic.smartcity.beans.TocationBean;
import com.magic.smartcity.utils.Constant;
import com.squareup.picasso.Picasso;
import com.youth.banner.adapter.BannerAdapter;

import java.util.List;

/**
 * @description:
 * @create: Create by Magic on 2022/2/3.
 */
public class HomeGuideImageAdapter extends BannerAdapter<TocationBean.RowsBean, HomeGuideImageAdapter.ItemHolder> {

    private static final String TAG = HomeGuideImageAdapter.class.getSimpleName();

    public HomeGuideImageAdapter(List<TocationBean.RowsBean> datas) {
        super(datas);
    }

    @Override
    public ItemHolder onCreateHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home_guide_topic, parent, false);
        return new ItemHolder(view);
    }

    @Override
    public void onBindView(ItemHolder holder, TocationBean.RowsBean data, int position, int size) {
        ImageView image = holder.itemView.findViewById(R.id.image);
        Picasso.get().load(Constant.Service_IP + data.getAdvImg()).into(image);
    }


    public class ItemHolder extends RecyclerView.ViewHolder {
        public ItemHolder(@NonNull View itemView) {
            super(itemView);
        }
    }
}
